<template>
    <div class="initiateInvitationBox">
        <!-- 搜索栏 start-->
        <div class="invite-sub">
            <img class="invite-logo" src="../../static/image/icon-title.png" alt="">
            <span class="inviteSearch">
              <input type="text" placeholder="搜索">
              <img src="../../static/image/sousuo.png" alt="">
            </span>
        </div>
        <!-- 搜索栏 end-->
        <!-- 导航跳转栏 start-->
        <adminHeader></adminHeader>
        <!-- 导航跳转栏 end-->
        <div class="initiate-contant">
            <!-- 切换栏 start-->
            <div class="courseNav">
                <div class="courseChange">
                    <span :class="{'courseActive':courseShow=='邀请中的课程'}" @click="courseShow='邀请中的课程'">邀请中的课程</span>
                    <span :class="{'courseActive':courseShow=='报名中课程已邀请名单'}" @click="courseShow='报名中课程已邀请名单'">报名中课程已邀请名单</span>
                </div>
                <div class="courseCreate">
                    <el-button type="text" class="creatButton" @click="dialogInviteCode = true"><img src="../../static/image/inv-code.png" alt=""><i>生成邀请码</i></el-button>
                    <router-link :to="{name:'invite-creatCourses'}" class="creatAlink"><img src="../../static/image/chuangjian.png" alt="">创建邀请课程</router-link>
                </div>
            </div>
            <!-- 切换栏 end-->
            <!-- 邀请中的课程 start-->
            <div class="inviteTable" v-if="courseShow=='邀请中的课程'">
                <table>
                    <thead>
                        <tr>
                            <th class="tableOne">
                                <input type="checkbox" label="全选" name="type" v-model="isCheckAll" @change="checkedAll">
                            </th>
                            <th class="tableTwo">课程名称</th>
                            <th class="tableThree">报名截止时间</th>
                            <th class="tableFour">开课日期</th>
                            <th class="tableFive">开课时间</th>
                            <th class="tableSix">人数</th>
                            <th class="tableSeven">管理操作<el-button  @click="mergeInvite()" class="merge-invited">合并邀请</el-button></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-if="inviteLists.length==0">
                            <td colspan="7" class="no-content">目前暂无邀请课程，请点选<router-link :to="{name:'invite-creatCourses'}">创建邀请课程</router-link>创建</td>
                        </tr>
                        <tr v-for="inviteList in inviteLists" :key='inviteList.courseId'>
                            <td>
                                <input v-if="inviteList.courseStatus == 4" type="checkbox" :value='inviteList.courseId' v-model="checkedLists">
                            </td>
                            <td>{{inviteList.courseName}}</td>
                            <td>{{inviteList.applyEndTime}}</td>
                            <td>{{inviteList.startTime|startData}}</td>
                            <td>{{inviteList.startTime|startTime}}</td>
                            <td>{{inviteList.numberOfPeople}}</td>
                            <td>
                                <router-link :to="{name:''}"><span><img src="../../static/image/course-detail.png" alt="">课程详情</span></router-link>
                                <router-link :to="{name:'invite-coursedetails',params:{id:inviteList.courseId}}" v-if="inviteList.courseStatus == 5">
                                    <el-tooltip :popper-class="noteTipClass"
                                        class="item" effect="dark"
                                        content="请在开课前的24小时内审核" 
                                        placement="left">
                                        <span><img class="examine" src="../../static/image/shenhe.png" alt="">进入审核</span>
                                    </el-tooltip>
                                </router-link>
                                <!-- <router-link :to="{name:'initiate-invitation-page',params:{id:inviteList.courseId}}" v-if="inviteList.courseStatus == 4">
                                    <span class="sigleInv"><img src="../../static/image/icon-sign.png" alt="">邀 请</span>
                                </router-link> -->
                                <a class="sigleInv singA" @click="invite(inviteList.courseId)" v-if="inviteList.courseStatus == 4">邀 请</a>
                            </td>
                        </tr>
                    </tbody>
                    <!-- {{checkedLists}} -->
                </table>
                
                <!-- page -->
                <el-pagination v-show="inviteListCount!=0" background layout="prev, pager, next" :total="inviteListCount" @current-change="InvitedCourse"></el-pagination>
                <!-- page end-->
            </div>
            <!-- 邀请中的课程 end-->
            <!-- 报名中课程已邀请名单 start-->
            <div class="inviteSign" v-if="courseShow=='报名中课程已邀请名单'">
                <!-- <table>
                    <thead>
                        <tr>
                            <th class="tableOne">头像</th>
                            <th class="tableTwo">姓名</th>
                            <th class="tableThree">手机</th>
                            <th class="tableFour">性别</th>
                            <th class="tableFive">子公司/部门</th>
                            <th class="tableSix">职位</th>
                            <th class="tableSeven">邀请时间</th>
                            <th class="tableEight">邀请课程</th>
                            <th class="tableNine">展开</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(inviteSignList,index) in inviteSignLists" :key='index'>
                            <td><img class="headPicture" :src="inviteSignList.headPicture" alt=""></td>
                            <td>{{inviteSignList.userName}}</td>
                            <td>{{inviteSignList.phoneNumber}}</td>
                            <td>{{inviteSignList.sex}}</td>
                            <td>{{inviteSignList.subsidiary}}</td>
                            <td>{{inviteSignList.postion}}</td>
                            <td>{{inviteSignList.inviteData}}</td>
                            <td>{{inviteSignList.inviteCourse}}</td>
                            <td>展开<img @click="expansion()" class="spread" :src="inviteSignList.selectPicture" alt=""></td>
                            <td>
                                <router-link to=""><span><img src="../../static/image/icon-sign.png" alt="">再次邀请</span></router-link>
                            </td>
                            <table>
                                <tbody>
                                    <div v-for="(inviteSubList,index) in inviteSignList.inviteSubLists" :key='index'>
                                        <div>{{inviteSubList.userName}}</div>
                                        <div>{{inviteSubList.phoneNumber}}</div>
                                        <div>{{inviteSubList.sex}}</div>
                                        <div>{{inviteSubList.subsidiary}}</div>
                                        <div>{{inviteSubList.position}}</div>
                                        <div>{{inviteSubList.inviteData}}</div>
                                        <div>{{inviteSubList.inviteCourse}}</div>
                                        <div>
                                            <router-link to=""><span><img src="../../static/image/icon-sign.png" alt="">再次邀请</span></router-link>
                                        </div>
                                    </div>
                                </tbody>
                            </table>
                        </tr>
                    </tbody>
                </table> -->
                 <!-- @expand-change="expandChange"
                @cell-click="handle" -->
                 <!-- @current-row-key="currentRowKey" -->
                <el-table :data="tableData1" style="width: 100%"
               @expand-change="expandChange">
                    <el-table-column label="头像" prop="" class="img">
                        <template slot-scope="props">
                            <img class="headPicture" :src="props.row.picUrl" alt="">
                        </template>
                    </el-table-column>
                    <el-table-column label="姓名" prop="name">
                    </el-table-column>
                    <el-table-column label="手机" prop="mobile">
                    </el-table-column>
                    <el-table-column label="性别" prop="gender">
                    </el-table-column>
                    <el-table-column label="子公司/部门" prop="department">
                    </el-table-column>
                    <el-table-column label="职位" prop="position">
                    </el-table-column>
                    <el-table-column label="邀请时间" prop="inviteTime">
                        <template slot-scope="props">
                            {{ props.row.inviteTime.split(' ')[0] }}
                        </template>
                    </el-table-column>
                    <el-table-column label="邀请课程" id="invited" prop="inviteCourse">
                    </el-table-column>
                    <el-table-column label="展开" prop="" type="expand">
                        <template slot-scope="props">
                            <table class="subTable">
                                <tbody>
                                    <tr v-for="(message,index) in props.row.messages" :key="index">
                                        <td>{{message.name}}</td>
                                        <td>{{message.mobile}}</td>
                                        <td>{{message.gender}}</td>
                                        <td>{{message.department}}</td>
                                        <td>{{message.position}}</td>
                                        <td>{{message.inviteTime.split(' ')[0]}}</td>
                                        <td>{{message.inviteCourse}}</td>
                                        <td>
                                            <el-button @click="sigleAgainInvite(message.courseId,message.mobile,$event)"><img src="../../static/image/icon-sign.png" alt="">再次邀请</el-button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </template>
                    </el-table-column>
                    <el-table-column label="" prop="">
                        <template slot-scope="props">
                            <el-button class="allInvi" @click="mergeAgainInvite($event)"><img src="../../static/image/icon-sign.png" alt=""><i class="changeTest">再次邀请</i></el-button>
                            <!-- <router-link :to="{name:''}"><span class="allInvite"><img src="../../static/image/icon-sign.png" alt="">全部邀请</span></router-link> -->
                            <!-- <router-link :to="{name:''}"><span class="allInvi"><img src="../../static/image/icon-sign.png" alt="">再次邀请</span></router-link> -->
                            <!-- <router-link :to="{name:''}" v-if="props.row.messages == 1"><span><img src="../../static/image/icon-sign.png" alt="">再次邀请</span></router-link> -->
                        </template>
                    </el-table-column>
                </el-table>
                <!-- page -->
                <el-pagination v-show="inviteSignCount!=0" background layout="prev, pager, next" :total="inviteSignCount" @current-change="invitingCourseMember"></el-pagination>
                <!-- page end-->
            </div>
            <!-- 报名中课程已邀请名单 end-->
        </div>
        <!-- 邀请码设置 Dialog-->
        <el-dialog  class="inviteCode"
        title="邀请码设置"
        :visible.sync="dialogInviteCode">
        <div class="invite-contant">
            <div class="invite-number">
                <h4>邀请人数</h4>
                <input v-model="requestInviteCode.invitePeopleNum" placeholder="60" type="" @change="validateNumber('requestInviteCode.invitePeopleNum')" @blur="validateNumber('requestInviteCode.invitePeopleNum')">
                <div class="cue" v-show="inviteNumberErr">邀请人数不能为空</div>
                <div class="cue" v-show="inviteNumErr">请输入数字</div>
            </div>
            <div class="timeAll">
                <div class="startTime">
                    <h4>邀请时效</h4>
                    <div class="startTimeCen">
                        <el-date-picker v-model="requestInviteCode.sDate" placeholder="2018/5/30" type="date" value-format="yyyy-MM-dd" format="yyyy-MM-dd" @change="validateData('requestInviteCode.sDate')" @blur="validateData('requestInviteCode.sDate')"></el-date-picker>
                        <el-time-picker 
                            style="border:none;" arrow-contro v-model="requestInviteCode.sTime" placeholder="18:30" value-format="HH:mm" format="HH:mm"
                            @change="validateData('requestInviteCode.sTime')" 
                            @blur="validateData('requestInviteCode.sTime')">
                        </el-time-picker>
                    </div>
                    <div class="cue" v-show="startDateErr" style="float:left">开始日期不能为空</div>
                    <div class="cue" v-show="startTimeErr" style="float:left">开始时间不能为空</div>  
                </div>
                <div class="marginLine"></div>
                <div class="stopTime">
                    <h4></h4>
                    <div class="stopTimeCen" >
                        <el-date-picker v-model="requestInviteCode.eDate" placeholder="2018-6-30" type="date" value-format="yyyy-MM-dd" format="yyyy-MM-dd" @change="validateData('requestInviteCode.eDate')"  @blur="validateData('requestInviteCode.eDate')"></el-date-picker>
                        <el-time-picker 
                            style="border:none;" arrow-contro v-model="requestInviteCode.eTime" placeholder="19:00" value-format="HH:mm" format="HH:mm"
                            @change="validateData('requestInviteCode.eTime')"
                            @blur="validateData('requestInviteCode.eTime')">
                        </el-time-picker>
                    </div>      
                    <div class="cue" v-show="endDateErr" style="float:left">结束日期不能为空</div>
                    <div class="cue" v-show="endTimeErr" style="float:left">结束时间不能为空</div>       
                    <div class="cue" v-show="endTimeHaErr" style="float:left">结束时间不能小于开始时间</div>    
                </div>
            </div>
        </div>
        <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="inviteCodeSet()">确 认</el-button>
        </span>
        </el-dialog> 
        <!-- 邀请码设置确认 Dialog-->
        <el-dialog  class="inviteCode"
        title="邀请码设置"
        :visible.sync="dialogInviteSure">
        <div class="invite-contant">
            <div class="invite-numberOf">邀请人数：<span>{{requestInviteCode.invitePeopleNum}}人</span></div>
            <div class="invite-aging">邀请时效：<br/><span>{{requestInviteCode.inviteStartTime}} 至 {{requestInviteCode.inviteEndTime}}</span></div>
            <div class="invite-code">
                <p class="invite-codeSingle">邀请码：
                    <span>{{inviteCode}}</span>
                    <br>
                    <span class="urlCode">{{url}}</span>
                </p>
                <div class="invite-codeLink">
                    <img :src="qrCode" alt="">
                    <div class="invite-codeAlink">
                        <p>
                            <button type="button"
                            v-clipboard:copy="url"
                            v-clipboard:success="onCopy"
                            v-clipboard:errIor="onError">复制链接</button>
                        </p>
                        <p>
                            <button type="button"
                            v-clipboard:copy="requestInviteCode.invitePeopleNum"
                            v-clipboard:success="onCopy"
                            v-clipboard:error="onError">复制邀请码</button>
                        </p>
                    </div>
                </div>
            </div>
        </div>
        <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="dialogClose()">确 定</el-button>
        </span>
        </el-dialog>
        <!-- 报名中课程已邀请名单再次邀请 Dialog-->
        <el-dialog  class="inviteSure"
        title=""
        :visible.sync="dialogInviteAgain">
        <div class="invite-contant">
            <div class="sureDialog">
                <p class="sureLeft">您已邀请{{name}}报名</p>
                <div class="sureRight">
                    <p v-for="(surelist,index) in surelists" :key="index">{{surelist.startTime.split(' ')[0]}}{{surelist.courseName}}课程</p>
                </div>
            </div>
        </div>
        <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="dialogInviteAgain = false">确 定</el-button>
        </span>
        </el-dialog>      
    </div>
</template>
<script>
    var bl = 0;
    // 引用 nav 组件 
    import adminHeader from '../components/adminHeader.vue';
    export default {
        components:{
            adminHeader:adminHeader
        },
        data() {
            return {
                // name: "发起邀请",
                courseShow:'邀请中的课程',
                //邀请码设置 Dialog
                dialogInviteCode: false,
                //邀请码设置确认 Dialog
                dialogInviteSure: false,
                // dialog邀请人数验证
                    // inviteNumber:'',
                inviteNumberErr:false,
                inviteNumErr:false,
                // dialog邀请时效验证
                    // startDate:'',
                    // startTime:'',
                    // endDate:'',
                    // endTime:'',
                startDateErr:false,
                startTimeErr:false,
                endDateErr:false,
                endTimeErr:false,
                endTimeHaErr:false,
                //邀请码内容
                invitePeopleNum:'',
                inviteStartTime:'',
                inviteEndTime:'',
                inviteCode:'',
                qrCode:'',
                url:'', // 链接
                //邀请码内容对象
                requestInviteCode: {
                    invitePeopleNum: "",
                    sDate:'',
                    sTime:'',
                    eDate:'',
                    eTime:'',
                    inviteStartTime: "",
                    inviteEndTime: ""
                },
                //邀请中的课程
                // 是否全选
                isCheckAll:false,
                checkedLists:[],
                // 邀请中的课程列表
                inviteLists:[],
                // //合并邀请对象
                // requestInviteMember:{
                //     checkedLists:[]
                // },
                // 邀请中课程列表页码总数
                inviteListCount: 0,
                //报名中课程已邀请名单
                // 报名中课程已邀请名单列表页码总数
                inviteSignCount: 0,
                tableData1: [],
                //审核提示
                noteTipClass:'page-login-noteTipClass',
                //报名中课程已邀请名单再次邀请 Dialog
                dialogInviteAgain: false,
                name:'',
                surelists:[],
            };
        },
        methods: {
            //邀请码设置Dialog
            inviteCodeSet:function(){
                this.requestInviteCode.inviteStartTime = this.requestInviteCode.sDate + ' ' + this.requestInviteCode.sTime,
                this.requestInviteCode.inviteEndTime = this.requestInviteCode.eDate + ' ' + this.requestInviteCode.eTime,
                console.log(this.requestInviteCode)
                let data = {
                    invitePeopleNum: this.requestInviteCode.invitePeopleNum,
                    inviteStartTime: this.requestInviteCode.inviteStartTime,
                    inviteEndTime: this.requestInviteCode.inviteEndTime,
                }
                console.log(data)
                this.$http.inviteCodeSet(data, (successRes)=>{
                    if (successRes.errCode == 0) {
                        this.invitePeopleNum = successRes.data.invitePeopleNum
                        this.inviteStartTime = successRes.data.inviteStartTime
                        this.inviteEndTime = successRes.data.inviteEndTime
                        this.inviteCode = successRes.data.inviteCode
                        this.qrCode = successRes.data.qrCode
                        this.url = successRes.data.url
                    }
                    // this.dialogInviteCode = false;
                    // this.dialogInviteSure = true;
                    console.log(successRes)
                },(errorRes)=>{
                    // alert("请正确填写数据")
                    console.log(errorRes)
                })
                this.dialogInviteCode = false;
                this.dialogInviteSure = true;
            },
            // dialog邀请人数验证
            validateNumber:function(){
                let regNumber = /^[1-9]\d*$/;
                if(this.requestInviteCode.invitePeopleNum == ''){
                    this.inviteNumberErr = true;
                    this.inviteNumberErr = false;
                }else if(!regNumber.test(this.requestInviteCode.invitePeopleNum)){
                    this.inviteNumErr = true;
                    this.inviteNumberErr = false;
                }else{
                    this.inviteNumberErr = false;
                    this.inviteNumErr = false;
                }
            },
            // dialog邀请时效验证
            validateData:function(type){
                if(type == 'requestInviteCode.sDate'){
                    if(this.requestInviteCode.sDate == ''){
                        this.startDateErr = true;
                    }else{
                        this.startDateErr = false;
                    }
                }
                if(type == 'requestInviteCode.sTime'){
                    if(this.requestInviteCode.sTime == ''){
                        this.startTimeErr = true;
                    }else{
                        this.startTimeErr = false;
                    }
                }
                if(type == 'requestInviteCode.eDate'){
                    if(this.requestInviteCode.eDate == ''){
                        this.endDateErr = true;
                        this.endDateErr = false;
                    }else if(this.requestInviteCode.eDate < this.requestInviteCode.sDate){
                        this.endTimeHaErr = true;
                        this.endDateErr = false;
                    }else{
                        this.endDateErr = false;
                        this.endTimeHaErr = false;
                    }
                }
                if(type == 'requestInviteCode.eTime'){
                    if(this.requestInviteCode.eTime == ''){
                        this.endTimeErr = true;
                        this.endTimeErr = false;
                    }else if(this.requestInviteCode.eTime < this.requestInviteCode.sTime){
                        this.endTimeHaErr = true;
                        this.endTimeErr = false;
                    }else{
                        this.endTimeErr = false;
                        this.endTimeHaErr = false;
                    }
                    // if(this.requestInviteCode.eTime == ''){
                    //     this.endTimeErr = true;
                    // }else{
                    //     this.endTimeErr = false;
                    // }
                }
            },
            //清除数据
            dialogClose:function(){
                this.dialogInviteSure = false;
                this.requestInviteCode.invitePeopleNum = "";
                this.requestInviteCode.sDate = "";
                this.requestInviteCode.sTime = "";
                this.requestInviteCode.eDate = "";
                this.requestInviteCode.eTime = "";
            },
            //复制成功
            onCopy: function (e) {
                this.$message({
                    message: '复制成功',
                    type: 'success'
                });
            },
            //复制失败
            onError: function (e) {
                this.$message({
                    message: '复制失败',
                    type: 'error'
                });
            },
            //全选单选
            checkedAll () {
                // 判断 全选/反选 是否点击
                if (this.isCheckAll) {
                    let arr = []
                    // 循环全部数据并push到一个数组中
                    // this.inviteLists.forEach(element => {
                    //     arr.push(element.courseId)
                    // });
                    let tempArr = JSON.parse(JSON.stringify(this.inviteLists));
                    for (const key in tempArr) {
                    if (tempArr.hasOwnProperty(key)) {
                        const element = tempArr[key];
                        if (element.courseStatus==5) {
                        tempArr.splice(key,1)
                        } else{
                        arr.push(element.courseId)
                        }
                    }
                }

                console.log(arr)
                    // 选中列表赋值，此时的arr已经是全部数据了，直接赋值就等于选中所有checkbox
                    this.checkedLists = arr
                } else {
                    // 如果 全选/反选 为假，则选中列表初始化
                    this.checkedLists = []
                }
            },
            //邀请中的课程
            InvitedCourse (currentPage = 1) {
                let data = {
                    // 当前页码
                    pageNow: currentPage,
                    // 每页显示数据条数
                    pageSize: 5,
                }
                this.$http.invitingCourse(data, (successRes)=>{
                    console.log(successRes)
                    this.inviteLists = successRes.data.adminAllInvitingCourseList;
                    this.inviteListCount = successRes.data.count;
                },(errorRes)=>{
                    console.log(errorRes)
                });
            },
            //邀请中的课程合并邀请
            mergeInvite:function(){
                console.log(this.checkedLists)
                if (this.checkedLists.length > 0) {
                    sessionStorage.setItem('courseArr', JSON.stringify(this.checkedLists))
                    this.$router.push({path:'initiate-invitation-page'}) 
                }
            },
            //邀请中的课程单课程邀请
            invite(courseId){
                console.log(courseId)
                let arr = [];
                if (courseId != '') {
                    arr.push(courseId)
                    sessionStorage.setItem('courseArr', JSON.stringify(arr))
                    this.$router.push({path:'initiate-invitation-page'}) 
                }
                
            },
            // 报名中课程已邀请名单
            invitingCourseMember (currentPage = 1) {
                let data = {
                    // 当前页码
                    pageNow: currentPage,
                    // 每页显示数据条数
                    pageSize: 5,
                }
                this.$http.invitingCourseMember(data, (successRes)=>{
                   let alldata=successRes.data.invitingCourseMemberLists
                   let newdata = new Array();
                    for(var i=0;i<alldata.length;i++){
                        for(var j=0; j<alldata[i].length; j++) {
                            if(j==0)
                            {
                                newdata.push(alldata[i][j]);
                                newdata[i]['messages'] = new Array();
                            }
                            newdata[i]['messages'].push(alldata[i][j]); 
                            this.tableData1.messages = newdata[i];
                        }
                          this.tableData1 = newdata;
                    }
                    console.log(newdata)
                    this.inviteSignCount = successRes.data.count;
                    // setTimeout(function(){
                    //     a();
                    // },500);
                },(errorRes)=>{
                    console.log(errorRes)
                });
            },
            //去除第一次无效的点击
            // invitLoad(){
            //     this.invitingCourseMember().then(val => { 
            //         this.inviteLoad();
            //     });
            // },
            //报名中课程已邀请学员单课程再次邀请
            sigleAgainInvite:function(courseId,mobile,event){
                let userId = JSON.parse(sessionStorage.getItem('login')).id
                let data = {
                    userId: userId,
                    courseIdList:[courseId],
                    inviteMemberModelList:[
                        {
                            inviteMemberMobile: mobile
                        }
                    ]
                }
                this.$http.inviteMemberAgain(data, (res)=>{
                    if(res.errCode == 0){
                        this.dialogInviteAgain = true
                        this.name = res.data.name;
                        this.surelists = res.data.courseModelList;
                    }
                    console.log(res)
                },(errRes)=>{
                    console.log(errRes)
                })
            },
            //报名中课程已邀请学合员并再次邀请
            mergeAgainInvite:function(event){
                let trData = this.tableData1;
                let courseIdList=[];//定义数组名称
                let inviteMemberModelList=[];//定义数组名称
                let vueajax = this.$http;
                let vuedialog = this;
                try {
                    const es = document.getElementsByClassName('el-table__row');
                    for (const key in es) {
                        es[key].onclick = function() {
                            let number = parseInt(key);
                            let obj={};//对象
                            var meobj=trData[number].messages;
                            for(var i=0;i<meobj.length;i++){
                                courseIdList.push(meobj[i].courseId);
                                obj.inviteMemberMobile=meobj[i].mobile
                                inviteMemberModelList.push(obj);
                            }
                            //后台请求参数
                             let data = {
                                userId:JSON.parse(sessionStorage.getItem("login")).id,
                                courseIdList:courseIdList,
                                inviteMemberModelList:inviteMemberModelList,
                            }
                            console.log(data)
                            //接口
                            vueajax.inviteMemberAgain(data,(res)=>{
                                if(res.errCode == 0){
                                    vuedialog.dialogInviteAgain = true;  
                                    vuedialog.name = res.data.name;
                                    vuedialog.surelists = res.data.courseModelList;
                                }
                                console.log(courseModeList)
                            },(errRes)=>{
                                console.log(errRes)
                            })

                        }
                    } 
                } catch (error) {
                    
                }
            },
            //当用户对某一行展开或者关闭的时候会触发该事件
            expandChange(row,expandedRows){
                try {
                    
                    // if(bl == 0){
                    //     bl++;
                    //      var ess =document.querySelectorAll(".el-table__expand-icon");
                    //         if(ess.length>1){
                    //             ess[ess.length-1].click();
                    //            // setTimeout(function(){ess[ess.length-1].click();},100);
                    //         }
                    // }
                    // var es = document.getElementsByClassName('el-table__expand-icon');
                    var es =document.querySelectorAll(".el-table__expand-icon");       
                    for (const key in es) {
                        es[key].onclick = function() {
                        var number  = parseInt(key);
                        if(row.messages.length >=2){
                                var i = number;
                                var cls = document.getElementsByClassName("allInvi")[i].getAttribute("class");
                                if( cls.indexOf("allInvite") == -1){
                                        if(this.className != "el-table__expand-icon el-table__expand-icon--expanded"){
                                            document.getElementsByClassName("allInvi")[i].setAttribute("class","allInvi allInvite");
                                            document.getElementsByClassName("changeTest")[i].innerHTML = '全部邀请';
                                        }
                                }else{
                                    document.getElementsByClassName("allInvi")[i].setAttribute("class","allInvi");
                                    document.getElementsByClassName("changeTest")[i].innerHTML = '再次邀请';
                                }
                            }
                        }
                    }
                } catch (error) {
                    
                }
            },
        },
        watch: {
            // 监听选中列表属性，当选中列表发生变化时，会运行此方法
            // checkedLists (newValue, oldValue) {
            //     // 每次运行时，判断当前选中列表中的数组个数是否等于全部数据的数组个数，如果到某一时刻全等，则全选按钮为选中
            //     if (newValue.length === this.inviteLists.length) {
            //         this.isCheckAll = true
            //     } else {
            //         // 否则为取消
            //         this.isCheckAll = false
            //     }
            // }
        },
        //切割时间日期
        filters:{
            startData(v){
                if (v != '') {
                    let date = v.split(' ')
                    return date[0]
                } else {
                    return '';
                }
            },
            startTime(v){
                if (v != '') {
                    let time = v.split(' ')
                    time = time[1].split('.')
                    return time[0]
                } else {
                    return ''
                }
            }
        },
        computed: {

        },
        created() {

        },
        mounted() {
            this.InvitedCourse();
            this.invitingCourseMember();
            // this.invitLoad();
        }
    };
//     function a (){
//                 //setTimeout(function(){},100);
//                 var es =document.querySelectorAll(".el-table__expand-icon");
//                 if(es.length == 0){
//                     a();
//                 }
//                 if(es.length>1){
//                    es[es.length-1].click();
//                     //setTimeout(function(){es[es.length-1].click();},100);
//                 }
//    }
</script>